﻿using System;
using System.Web;
using Rabbit.Logic;
using RabbitManage.Code;

namespace RabbitManage.UI
{
    public partial class ShopDetail : System.Web.UI.Page
    {
        protected Shop item = null;
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpCookie cookie = Request.Cookies[Constant.CookieName];
            string shopId = cookie.Values[Constant.CookieUid];
            item = RabbitUse.GetShopByShopId(Db.Store, shopId);

            if (item == null)
            {
                item = new Shop();
                item.ShopId = shopId;
                item.Location = new Address();
                RabbitUse.AddOrUpdateShop(Db.Store, item);
            }

            if (item.Location == null)
            {
                item.Location = new Address();
            }
        }
    }
}